/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Locale;
import java.util.Scanner;

/**
 * <p>Project: javase - Str2
 * <p>Powered by webrx On 2021-12-02 15:16:51
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Str2 {
    public static void main(String[] args) {
        var s1 = "ok";
        var s2 = "Ok";
        var s3 = "ok";
        var s4 = new String("ok");
        var s5 = new String("ok");
        System.out.println(s1 == s2);
        System.out.println(s1 == s3);
        System.out.println(s1 == s4);
        System.out.println(s4 == s5);

        //id = 2424284234
        // == 判断是不是一个对象（地址，内容都一样）
        System.out.printf("%s - %s - %s%n", s1, s4, s5);

        System.out.println(s1.equals(s4));
        System.out.println(s1.equals(s2));
        System.out.println(s1.equalsIgnoreCase(s2));
        System.out.println(s4.equals(s1));

        //zhangsan
        //ZhangSan
        System.out.println("Hello".toLowerCase());
        System.out.println("Hello".toUpperCase());

        //判断账号的案例
        String a = null;

        //NullPointerException
        if ("admin".equals(a)) {
            System.out.println("登录成功");
        } else {
            System.out.println("登录失败");
        }

        //Scanner sc = new Scanner(System.in);
        //System.out.print("请输入账号：");
        //String ina = sc.nextLine();
        //ina.equals(a)
        //a.equals(ina)
        //if (a.equalsIgnoreCase(ina)) {

        // }
        //if (a.equals(ina)) {
        //
        //}

        //"123".equals(s1)
        //s1.equals("123")


    }
}
